package com.xpc.mapper;

import com.xpc.pojo.vo.UserAllInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Project：UniversityGradeAdministrationSystem
 * Date：2022/5/27
 * Time：2:06
 * Description：TODO
 *
 * @author 南北辰的键盘
 * @version 1.0
 */
@Mapper
public interface UserAllInfoMapper {

    /**
     *
     * @return
     */
    @Select("select distinct a.account_id id, u.name name, u.gender sex, m.name major, s.date birth, s.nation nation, s.phone phone, s.native nationPlace, f.father fatherName, f.f_phone fatherPhone, f.mother motherName, f.m_phone motherPhone, s.id_cdoe personID, s.dorm dormitoryNo, u.head_portrait imgUrl from (ctas.student s, ctas.user u, ctas.account a, ctas.major m, ctas.class c) left join ctas.family f on u.user_id = f.user_id where s.user_id = u.user_id and u.user_id = a.user_id and m.id = s.major_id;")
    List<UserAllInfo> selectUserAllInfo();

    @Select("select distinct a.account_id id, u.name name, u.gender sex, m.name major, s.date birth, s.nation nation, s.phone phone, s.native nationPlace, f.father fatherName, f.f_phone fatherPhone, f.mother motherName, f.m_phone motherPhone, s.id_cdoe personID, s.dorm dormitoryNo, u.head_portrait imgUrl from (ctas.student s, ctas.user u, ctas.account a, ctas.major m, ctas.class c) left join ctas.family f on u.user_id = f.user_id where a.account_id = #{account_id} and s.user_id = u.user_id and u.user_id = a.user_id and m.id = s.major_id;")
    UserAllInfo selectUserAllInfoById(@Param("account_id")String account_id);

// 增User
    @Insert("INSERT INTO ctas.user (user_id, nickname, head_portrait, name, gender, password, salt, position_state) VALUES ()")
    int saveUser();
// 增Account
// 增CounselorInfo
// 增Student
// 增Family

// 删User
// 删Account
// 删CounselorInfo
// 删Student
// 删Family

// 改User
// 改Account
// 改CounselorInfo
// 改Student
// 改Family

// 查User

// 查Account
// 查CounselorInfo
// 查Student
// 查Family



}
